import java.util.Scanner;

/**
 * Created by dllo on 18/3/29.
 */
public class Question02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入月");
        int month = scanner.nextInt();
        System.out.println("输入日");
        int day = scanner.nextInt();
         int sum=0;
//        case 4:
//        sum+=31;
//        case 3:
//        sum+=28;
//        if((year%100!=0&&year%4==0)||year%400==0){sum+=1;};如果是闰年
//        case 2:
//        sum+=31;
//        case 1:
//       sum+=day;
        switch (month) {
            case 1:
                System.out.println(day);
                break;
            case 2:

                System.out.println( + 31);
                break;
            case 3:
                System.out.println(day + 59);
                break;
            case 4:
                System.out.println(day + 90);
                break;
            case 5:
                System.out.println(day + 120);
                break;
            case 6:
                System.out.println(day + 151);
                break;
            case 7:
                System.out.println(day + 181);
                break;

            case 8:
                System.out.println(day + 212);
            case 9:
                System.out.println(day + 243);
                break;
            case 10:
                System.out.println(day + 273);
                break;
            case 11:
                System.out.println(day + 304);
                break;
            case 12:
                System.out.println(day + 334);
                break;

        }
    }
}
